package com.c6906.vdam.das.model.entity;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
public class EWVehiclesNoTask {
    private String dayType;
    private Date startTime;
    private BigDecimal startLon;
    private BigDecimal startLat;
    private String startAddr;
    private Date endTime;
    private BigDecimal endLon;
    private BigDecimal endLat;
    private String endAddr;
    private Long duration;
    private BigDecimal mileage;

    public EWVehiclesNoTask(TerminalDMData first, TerminalDMData last, double subtract, String dayType) {
        this.dayType = dayType;
        this.startTime = DateUtil.parse(first.getTerminalTime());
        this.endTime = DateUtil.parse(last.getTerminalTime());
        this.duration = DateUtil.between(this.startTime, this.endTime, DateUnit.MINUTE);
        this.startLon = first.getLongitude();
        this.startLat = first.getLatitude();
        this.endLon = last.getLongitude();
        this.endLat = last.getLatitude();
        this.mileage = BigDecimal.valueOf(subtract);
    }
}
